If you had 2 original keys, there's a procedure to follow to program a 3rd key.
With only 1, you need an OBD2 Adapter & FORSCAN to program the chipped keys in the antitheft system.
You can purchase used Mazda 5 keys from a scrapyard and the remote part can be programmed for the doors, plus I...