We give an expression for the Lindblad torque acting on a low-mass planet embedded in a protoplanetary disk that is valid even at locations where the surface density or temperature profile cannot be approximated by a power law, such as an opacity transition. At such locations, the Lindblad torque is known to suffer strong deviation from its standard value, with potentially important implications for type I migration, but the full treatment of the tidal interaction is cumbersome and not well suited to models of planetary population synthesis. The expression that we propose retains the simplicity of the standard Lindblad torque formula and gives results that accurately reproduce those of numerical simulations, even at locations where the disk temperature undergoes abrupt changes. Our study is conducted by means of customized numerical simulations in the low-mass regime, in locally isothermal disks, and compared to linear torque estimates obtained by summing fully analytic torque estimates at each Lindblad resonance. The functional dependence of our modified Lindblad torque expression is suggested by an estimate of the shift of the Lindblad resonances that mostly contribute to the torque, in a disk with sharp gradients of temperature or surface density, while the numerical coefficients of the new terms are adjusted to seek agreement with numerics. As side results, we find that the vortensity related corotation torque undergoes a boost at an opacity transition that can counteract migration, and we find evidence from numerical simulations that the linear corotation torque has a non-negligible dependency upon the temperature gradient, in a locally isothermal disk.