UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ah9Oyx66N9vdoyf0Vf6X5zbBIETwIAMR8iAvYFH4Xm0='
WHERE
key_id = '4b04ee95b15e003cdd161685e487207801d111afb00ece8f67904e0be78ee787'
AND (
token = 'Ah9Oyx66N9vdoyf0Vf6X5zbBIETwIAMR8iAvYFH4Xm0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)