We study thermodynamics of black hole solutions in Lanczos–Lovelock anti-de Sitter gravity in d + 1 dimensions coupled to nonlinear electrodynamics and a Stückelberg scalar field. This class of theories is used in the context of gauge/gravity duality to describe a high-temperature superconductor in d dimensions. A larger number of coupling constants in the gravitational side is necessary to widen the domain of validity of physical quantities in dual quantum field theory (QFT). We regularize the gravitational action and find the finite conserved quantities for a planar black hole with scalar hair. Then we derive the quantum statistical relation in the Euclidean sector of the theory, and we obtain the exact formula for the free energy of the superconductor in the holographic QFT. Our result is analytic and it includes the effects of backreaction of the gravitational field. We further discuss on how this formula could be used to analyze second order phase transitions through the discontinuities of the free energy, in order to classify holographic superconductors in terms of the parameters in the theory.