UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qQq0k5GkTIHMR+J4chsOK7M54kE8Rx0LChN5AcwyWO8='
WHERE
key_id = '22a2fbab294a461bdb83e04bb316864b167555d04fb189068e21d1991d7d5778'
AND (
token = 'qQq0k5GkTIHMR+J4chsOK7M54kE8Rx0LChN5AcwyWO8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)