Several systems display an equilibrium condensation transition, where a finite fraction of a conserved quantity is spatially localized. The presence of two conservation laws may induce the emergence of such transition in an out-of-equilibrium setup, where boundaries are attached to different and subcritical heat baths. We study this phenomenon in a class of stochastic lattice models, where the local energy is a general convex function of the local mass, mass and energy being both globally conserved in the isolated system. We obtain exact results for the nonequilibrium steady state (spatial profiles, mass and energy currents, Onsager coefficients) and we highlight important differences between equilibrium and out-of-equilibrium condensation.