In this paper, we present a method to learn approximate discrete-time control barrier functions and integrate them into variational inference MPC (VIMPC) to address the problem of meeting safety specifications beyond the prediction horizon in model predictive control (MPC). To achieve a trade-off between exact recursive feasibility, computational traceability, and applicability to 'black-box' dynamics, we propose a novel sampling strategy that significantly reduces the variance of the estimated optimal control and enables real-time planning on the CPU. The resulting Neural Shield-VIMPC (NS-VIMPC) controller significantly improves safety compared to conventional sample-based MPC controllers, and we verify its effectiveness under poorly designed cost functions through simulations and real hardware experiments.