UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fa4e7CkPn7meJlNM5wZ7DUz0ljszUJ3/K6eODtAmPk4='
WHERE
key_id = '1ac711aaa35fcd9927895343c16fc6c771d0d57e3052f57e98deccfa29e59fb1'
AND (
token = 'fa4e7CkPn7meJlNM5wZ7DUz0ljszUJ3/K6eODtAmPk4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)