A few points:
how is it to lock? Perhaps retraction springs?
most cylinders have a piston with a thread or clamping section to fix to.
can two counter-acting cylinders be used which would mean swapping pipes on the pump or a changeover switch.
consider mounting the cylinder(s) next to the lock which gives more control of the rod and reduces any flexing.