UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tmhK9xtJiXO0Fo3+AKfxIPgucPWe25Paja8W3xe3UHY='
WHERE
key_id = 'b62b6555c81bb685f71b8b4094b35750569d58bb81cef7e37bbe95d3b77db38e'
AND (
token = 'tmhK9xtJiXO0Fo3+AKfxIPgucPWe25Paja8W3xe3UHY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)