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