UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AnViZz4c1XQEwXbbi4E5BFqj4D75CBZ4jq3LGH+SGIY=' 
WHERE 
  key_id = '79833c15eb9444ca8718705d4c754945b9da71c296f9de50308428e024608bec' 
  AND (
    token = 'AnViZz4c1XQEwXbbi4E5BFqj4D75CBZ4jq3LGH+SGIY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034