Your next step is to attempt reprogramming the remote.
There is a procedure to do so that is too complex to explain here. I recommend seeing your local Mazda dealership or trusted shop. I know at my Mazda dealership, my people will gladly attempt a reprogram as a complimentary service. Hopefully this is true for most places.
If this does not work, you may need to replace the remote entirely.