UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xC3//8o+KZWVYkts94E//vOtny6hjQwOxmXVeOuip4M='
WHERE
key_id = '9911725d9e70527a2189599b75c19e7ee12a094a34ff03836f6ec81f5b7051b6'
AND (
token = 'xC3//8o+KZWVYkts94E//vOtny6hjQwOxmXVeOuip4M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)