At some point your diamond shaped bmw key will stop working. Or it will be battery or maybe something will brake in it.
The cheapest way is to cut it in half and replace broken parts. Then you can purcashe battery and key fob on ebay for few eur. Just solder it back.
This is with old key with new case from ebay, I didn’t want to cut new key so I used old one and glue it with some epoxy
If you use old key case, just glue it back with epoxy or something similiar and leave it over night.
In some case you need to program it. On my x3, you put key in to position 1 and take iz out, than press and hold unlock button while pressing lock button 3 times.