UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KbefWaKAqimyT/7N+VAKESkUhDjbXxYV1jRdgEZ0Jmw='
WHERE
key_id = '0773e1d36771bfa9b572b96eca61d449b8ffffbbe3feeec1495c3516ad61ea0a'
AND (
token = 'KbefWaKAqimyT/7N+VAKESkUhDjbXxYV1jRdgEZ0Jmw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)