SELECT `id` FROM `table` WHERE `idz` = '123' AND `idu` != '321' AND `ip` BETWEEN INET_ATON('123.123.0.0') AND INET_ATON('133.133.255.255') AND `s` = '2'
SELECT `id` FROM `table` WHERE `idz` = '123' AND `idu` != '321' AND (`ip` BETWEEN INET_ATON('123.123.0.0') AND INET_ATON('133.133.255.255')) AND `s` = '2'