Have a Car Question? Ask a Mechanic Online.
How many keys do you have?
Do you have any aftermarket equipment installed? (alarm, remote starter,etc..)
Have you tried both keys?
You can try disconnecting the battery for 15 minutes and then attempting the keys again. It is possible that one key has gone bad and from trying it too many times it has locked the security system so the good key is not responding. If this doesn't work you should still be under the Mazda factory warranty. I would call them and explain the situation, the tow job and the repairs should be covered.
There is no easy fix for this. It could be a key problem, the receiver or a PCM problem. It's impossible to tell which without the proper scan tool. Try to reset it first as I mentioned above, then next step is to the Mazda dealer.
The only other issue would be if a battery was just installed or if the vehicle was jump started it could have blown a fuse in the passenger junction box which is located under the glovebox.