UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P859jSAd+bwzC5cIo6HVHUxHBJArFO2W3haKQfF5SQs='
WHERE
key_id = 'e38fbbaad2abeea098e6afe37bd4e3ac8246aa3ef48a044b6fbd1e78d684a1bf'
AND (
token = 'P859jSAd+bwzC5cIo6HVHUxHBJArFO2W3haKQfF5SQs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)