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