I would have to say that it's a coincidence that the first key went bad.
There is a transponder inside the key that can go bad and keep the car from starting. The locking/unlocking is sort of a seperate issue. I have seen this happen like you are describing where a key will still unlock the car but not allow the engine to start.
My advice is to buy yet another key if you want to have 2 working keys.