UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UO6AXq8+fFndvuAY2OQNBjdOmaZVd9qbWm464TJJ9tg='
WHERE
key_id = 'f0a873f590403ebaf4e99c206afc3f9e76235123f05db9b7dac9c7bb58592b5e'
AND (
token = 'UO6AXq8+fFndvuAY2OQNBjdOmaZVd9qbWm464TJJ9tg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)