UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x+0ISv0tXpIpgIFhgwCJoYqdmqx29Is7QgLmpXlULt8='
WHERE
key_id = '6cc1ff6be3b7fcf36012b3ca0bf7e0a2ac603ca767a9b2c9ca2b8d091e6a6298'
AND (
token = 'x+0ISv0tXpIpgIFhgwCJoYqdmqx29Is7QgLmpXlULt8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)