Not sure on Mazda. In case of BMW, I've been told by BMW dealer that there are 7 sets of remote key associated with each car including the first 2 coming with the new car. The unique hard coded security key is build-in for the remote key and engine immobilization system. If you lost or damaged all 7 keys you're out of luck! You can't just buy a used remote key from eBay and have dealer re-program it. You have to get a new remote key matching you VIN from dealer with a proof of ownership.