UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aqFEc7Nr68x1BSLXg6w7eGwRRlSPRwvCCqXmnx7smHM='
WHERE
key_id = '9b897e4ce053cdb97cde5c214bdb969a73eaa26f501fbdd4bba832791ac9a2f9'
AND (
token = 'aqFEc7Nr68x1BSLXg6w7eGwRRlSPRwvCCqXmnx7smHM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)