UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7UXtPMLZXdvvyIygPzW3PRuCw1C3KeQkIyoEuPZ1+lw='
WHERE
key_id = 'b982b561c6de45b73f2a3029bc453118c0c87310da41a06c712af3d53763dac4'
AND (
token = '7UXtPMLZXdvvyIygPzW3PRuCw1C3KeQkIyoEuPZ1+lw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)