Looks like you will have to take the vehicle to an authorized Mazda dealer, and will have to take all the keys with you.
What you can try is disconnect the battery for 15 to 30 minutes and reset the computers.
This is from the owners manual of 2013 Mazda 2:
The system is armed when the ignition is switched from ON to ACC or OFF. The security indicator light in the instrument cluster flashes every two seconds until the system is disarmed.
The system is disarmed when the ignition is switched ON with the correct ignition key. The security indicator light illuminates for about three seconds and goes out.
If the engine does not start with the correct ignition key, and the security indicator light keeps illuminating or flashing, the system may have a malfunction. Consult an Authorized Mazda Dealer.
Troubleshooting Security System:
If the security indicator light illuminates and stays on or flashes when the ignition is switched ON, the engine will not start.
Signals from a TV or radio station, or from a transceiver or a mobile telephone, could interfere with your immobilizer system. If you are using the proper key and your engine fails to start, check the security indicator light. If it is flashing, remove the ignition key and wait 2 seconds or more, then reinsert it and try starting the engine again. If it does not start after 3 or more tries, contact an Authorized Mazda Dealer.
If the security indicator light flashes continuously while you are driving, do not shut off the engine. Go to an Authorized Mazda Dealer and have it checked. If you shut off the engine while the light is flashing you will not be able to restart it.
Since the electronic codes are reset when repairing the immobilizer system, the keys are needed. Bring all the existing keys to an Authorized Mazda Dealer.