Yeah, there’s no way this can work for real.
If the trigger is in the key loop, someone will shoot themselves if they attach it anything, like a key ring or a key hook on the wall. If the trigger is not in the loop but on the shaft - I think there’s about a 50/50 chance that they’ll hit the trigger when turning the key - thus blowing the lock out… assuming that doesn’t shoot the key into their gut in which case they aren’t going to be worrying much about the future anymore, they now have a door that doesn’t lock.
Best case scenario, they are threatened in the cell with the door locked behind them… they have one shot (which will probably blow their hand off) - but only if they don’t try to unlock the door.