UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8iAxHiv9F0w3euZh5Wr0CSqImiUUFM01MU9++AGoMXg='
WHERE
key_id = 'ae9160eb65b04527935f80d6c66102c3f93d56dd5702be679ed605959f9f6ed7'
AND (
token = '8iAxHiv9F0w3euZh5Wr0CSqImiUUFM01MU9++AGoMXg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)