MariaDB optimizing geo IP lookup with Maxmind GeoLite2 database
OR is inefficient.  It can be turned into UNION.  An example:  http://mysql.rjweb.org/doc.php/index_cookbook_mysql#or
Why use INET6_ATON on IPV4 values?
Finding something in a range is poorly optimized, primarily because the Optimizer does not know whether there are overlapping ranges.  One solution is given here:  http://mysql.rjweb.org/doc.php/ipranges