UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '065JWxsnNjLY75zWdXCcyUXVPl5+tKLBz2h6K3Jwf5Y='
WHERE
key_id = '674872040bbd2539b29f40079e6a8e06f781ace955be55e04735af2b89b3df66'
AND (
token = '065JWxsnNjLY75zWdXCcyUXVPl5+tKLBz2h6K3Jwf5Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)