UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CtljnfoCrFWZE6G1nQQE5DOgdVEcMgQIyaWnFiK6+2I='
WHERE
key_id = 'fbf7787511de7db56dfb6e14e1f9593234f9c3f9ccc0c8d2c3dfdf70960ce06e'
AND (
token = 'CtljnfoCrFWZE6G1nQQE5DOgdVEcMgQIyaWnFiK6+2I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)