UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lVpXPAZDPwSlOKePVrDJDcpacHVYknL0UYb9+U6aWL0='
WHERE
key_id = 'fbebd2147ba487f410cb2311e60e49c18bebd6da519679dcf25ad693d7ccd285'
AND (
token = 'lVpXPAZDPwSlOKePVrDJDcpacHVYknL0UYb9+U6aWL0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)