UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LkTujx6b4h7SrX9rWfyG2ufjmgCC2aCchUUeID1JREs='
WHERE
key_id = '046c37617e98cd64f375d20b875ca55613cfd8b9ccc4fed678a84592d6f70f12'
AND (
token = 'LkTujx6b4h7SrX9rWfyG2ufjmgCC2aCchUUeID1JREs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)