I had this exact problem.
Problem was using 2 different fobs at the same time would mess it all up. Put one of the fobs away and only use 1 of them at a time.
I take it both fobs now fail to lock and unlock the car? You will just have to use the central locking button on the drivers side door to lock all the doors for the time being, after a few days one of your fobs will just start working again for no reason. When it does just stick with that one.
Worked for me, no idea why and my other fob still won't work. Tried replacing the batteries, didn't help.