UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a2ABiL/wGKZkZfYr0a9yG9nmhPAXWTgUJ+dvSCyY40E='
WHERE
key_id = '766eb76132dffdbc8396d3977b6396ee148158d64c17d83c581e8a0abea95bd0'
AND (
token = 'a2ABiL/wGKZkZfYr0a9yG9nmhPAXWTgUJ+dvSCyY40E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)