I have saved a fair number of key switches with WD40.
I also annually use WD40 on all my vehicle locks, just a wee squirt and never have frozen locks.
20 years or so ago I owned an aviation facility and the WD factory rep stopped by for some service issue on his aircraft.
After some good chatting I started servicing aircraft radios based on his input.
WD is non corrosive and cleans (maybe flushes) dirt and crap, lubricates and generally simply renews the guts of switches.
Early radios had stacks of rotary contact switches that were constantly intermittent and WD was one great solution.
While 'contact cleaners' do clean they don't leave any lubricant behind while WD will and as well is a non conductive lubricant.
When it comes to ignition switches they get dry and the contact lube hardens. WD softens that lube back to specs and the switch is good to go again.
I once had a client with a '50's Cessna 310 that had loads intermittent problems.
He insisted that we service as he was leaving on a long flight.
I wanted to refuse but he insisted so under a signed waiver I 'shot gunned' his troubles by squirting WD in all the contacts, plugs and connectors of all his electronic systems, including the autopilot.*
Weeks later he reported that he flew cross country and back with all his systems functioning up to specs. (and that under IFR conditions)
Being a twin engine AC that 'shot gunning' took about 5 hours as cables ran everywhere and lots of seats, upholstery etc were in the way.
*we opened and closed every contact while damp with WD so as to apply slight friction, even did a squirt in toggle switches.