UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XQAzbPWcVnkvZc8vzn4qrd5yZ85L7RrJ69eQDlUTjRY='
WHERE
key_id = 'e1b6da55da1d596aa5a41b6033279f062085aa3c7e242844ac757a1bc8a0b0ce'
AND (
token = 'XQAzbPWcVnkvZc8vzn4qrd5yZ85L7RrJ69eQDlUTjRY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)