UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4nwk8dic1a+pGdAZluAWlZv5Mf1hGn+BE3QpIGtIXk8='
WHERE
key_id = 'd3b7fa7434a827f6cd35b68b848cce59d7ef13744ed5ef237ba231d9780aaf16'
AND (
token = '4nwk8dic1a+pGdAZluAWlZv5Mf1hGn+BE3QpIGtIXk8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)