UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YQz1z43RRDEcOA+SR2LxPjg+paObedzczc1J4et+GAY='
WHERE
key_id = '64970e79252fd1868e6dd6c5b83a047a535bfe3f6d046abe11418a6ddfe3f203'
AND (
token = 'YQz1z43RRDEcOA+SR2LxPjg+paObedzczc1J4et+GAY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)