I find myself in this situation often: I refactor a bit of common code into a helper function, then run into borrowing errors.
Very often, one cannot - as in most other languages - simply move a bit of (referentially-transparent) code from the body of one function to a standalone function.
By the way, you are not using &self, so it would better be a free standing function or static method. Borrowing &self may potentially cause borrow-checker errors too.
As @Ddystopia said, Box won't help. The reason you're getting an error is because you're transferring ownership to the function by not borrowing the Mutex. You'll need to understand ownership to use Rust. Please ask any questions you have about ownership in this situation (it won't work to rely on the IDE to always give you what you want).
The elision rules assume the returned guard should borrow from self, when it actually borrows from the Mutex.
In your OP, you can remove the &self parameter entirely, since self is not used within the function. Rust isn't Java, you can just have free functions without defining an associated class/struct. If you do actually need self for something, the right lifetime signature is this:
That code correlates the lifetime of key with the lifetime of the MutexGuard, which is unnecessary. Removing the lifetime on key and letting it be elided should work: