§91.413 ATC transponder tests and inspections.
(a) No persons may use an ATC transponder that is specified in 91.215(a), 121.345(c), or §135.143(c) of this chapter unless, within the preceding 24 calendar months, the ATC transponder has been tested and inspected and found to comply with appendix F of part 43 of this chapter;
Nothing there about "Except in airspace where transponders are not required," or "Except within 50nm for training flights" or "Except [anything else]". If it's out of inspection currency, you are not permitted to select anything above "STBY" anywhere in US airspace. Only situation I can see doing otherwise would be in an emergency, lost comm, or hijack situation choosing to turn it on to 7700/7600/7500 as appropriate under your 91.3(b) emergency authority.