UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oCoZSAewkBnuOdGzBrMWvacUVUTqwEtxlpssIyheqTk='
WHERE
key_id = '31543f687110b69f83991f4ccea6c87c9581ca1eb7e9f25ce101d578a89a7626'
AND (
token = 'oCoZSAewkBnuOdGzBrMWvacUVUTqwEtxlpssIyheqTk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)