UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7ZTT4HzcWcy0tlI+qxhgbJRQayHlgYjMFDzlsq8ULTg='
WHERE
key_id = 'a01c446947d4cef8813efb5bff20d8b354d8b192ca79f1a3bea7c8191ed356a2'
AND (
token = '7ZTT4HzcWcy0tlI+qxhgbJRQayHlgYjMFDzlsq8ULTg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)