How to install a replacement lock in a mailbox?
Remove the hex nut. Insert the lock. Replace the hex nut.

You'll probably need to use the key to hold the assembly while you loosen the nut, but it shouldn't be too tight. If it is for some reason, maybe use a large flat-blade screwdriver and just insert it a bit into the keyslot. In a worst-case scenario, put a wrench or pliers sideways on the lock latch and hold it that way.