I locked my keys in my y34 m45 over the weekend and wound up having to use some airbags to force it open a bit on the driver side seam, then stuck a locksmith's tool in to pull the emergency release on the top of the trunk lid. I just kept scraping the hook across the underside of the lid until it grabbed onto the lever.
In the end I also needed to readjust the striker to bring it back down to where it should be. It was a "journey."
Guess this was an oversight for y34s, I've seen posts where later models wouldn't allow you to lock your keys in the trunk.