UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZFnhbSfXudEIBBuCSn1IyGpw9hOYvbqCw3rX80xnck0='
WHERE
key_id = '1b2637f2e54f9ff63d459ebcae72d3abb4c79392c1650b87b57466a8beeac982'
AND (
token = 'ZFnhbSfXudEIBBuCSn1IyGpw9hOYvbqCw3rX80xnck0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)