UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4lH12ibmWNoWy/GRp9fD3VNDeH9d6wN9KSATTxIkn5k='
WHERE
key_id = '02221f7f286095a38d5bd2f2c05e45ea3f7404df2f04a3cd37c82a4f642a2947'
AND (
token = '4lH12ibmWNoWy/GRp9fD3VNDeH9d6wN9KSATTxIkn5k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)