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