I mask taped my fork lowers before glass beading them. The tape was in place when I finished, but I had to wash it 4 times with hot soapy water before I got it clean. I would not bead blast engine parts, but masking and cleaning the lock should be ok. Can you remove the key lock part and replace after painting?
Steve