Just done this when I sold my panniers. If you pull the hinge pin out you can then use a small screwdriver to release the lock on the key - I think it is the las tumbler that locks it in. Pull the lock out and put it to one side and reassemble the buttons, put the hinge pin back in and screw it all back together. It looks scary but is pretty easy and you are just abut there in your photos.
You can either buy new locks for about £20 each from memory, or just re-jig the tumblers you have, or if you have a friendly dealer take what you have down there and use the pile of spares they normally have lying around to match it up. You can then just push the lock into the hole and it will click and lock into place.