UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Etzz7Z83MAG6AiLumd17otWW8vBWE3AOkf9LcIgwE6A='
WHERE
key_id = 'b39f10d11664f39915676ac2cdd0a057a37d5c065cb96fd1ff47b65c9ea77e91'
AND (
token = 'Etzz7Z83MAG6AiLumd17otWW8vBWE3AOkf9LcIgwE6A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)