You can try some "lock Ease", or powdered graphite in the lock cylinder, but you likely have a broken tumbler inside the lock. Those are the brass pins that fall into the grooves on the key. The key code for your ignition key is inside the passenger door on the lock mechanism. The inner door panel needs to be removed, and the door lock needs to be partly removed to see the code numbers on the door lock cylinder You can then order a matching keyed cylinder. The less expensive way is to just purchase a new aftermarket lock cylinder that will come with a different key that won't fit your doors. To remove the ignition lock cylinder, remove cover panel under steering wheel. Insert key into ignition, turn key to acc, push button on bottom of cylinder under the dash, and pull the cylinder out of the dash. Install in reverse order.

Trying the spare key should be the first step as you recommend. If the ignition lock, and door locks are all acting up, then a new key can be made with the key code stamped on the passenger front door cylinder lock that will allow all locks to work again.

correct. I'm only saying it because it happened to my wife's car which coincidentally happens to be a 97 rav4. It got stuck in the switch and wouldn't turn or let go. I was already changing the switch on my mind until I got it out noticed it was acting up on the door locks as well like you said. luckily my problem was the key it self, hope you have the same luck.

I fully agree! Went through the same trouble with a very well used 97 RAV 4 and fixed it with a new code key, and removed the broken tumbler from our lock which this type of repair isn't for the faint of heart.