I second Robin's concern about the solenoid idea.

You might get away with a motor and a cam, or perhaps just motorise the locking bolt. It'll be slower than Robin's cylinder, but would be all electric in operation.