UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cz4RkVc+VMutb01+JJGjFw7Wfzuu440YAqx+HB+Ps0A='
WHERE
key_id = '9d81d37a23d63d3be79574e23c8e3481d574d616b89fa49b516d265fb9bb3f60'
AND (
token = 'cz4RkVc+VMutb01+JJGjFw7Wfzuu440YAqx+HB+Ps0A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)