How to return last used record? I have simple table called ips with 2 field ip and address, which schema is following

CREATE TABLE IF NOT EXISTS `ips` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `address` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ips_address_unique` (`address`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2;


in table there are some IP inserted

INSERT INTO `ips` (`id`, `address`) VALUES (1, '123.123.123.123');
INSERT INTO `ips` (`id`, `address`) VALUES (1, '124.124.124.124');
INSERT INTO `ips` (`id`, `address`) VALUES (1, '125.125.125.125');


How to create query that return 123.123.123.123 first time, 124.124.124.124 second time, 125.125.125.125 third time, 123.123.123.123 fourth time and so on...? 

The only one solution that comes to my mind is idea of storing id of last returned IP in memory and then query for ip with id greater than stored. Anyway, I'm going to repeat that query multiple times in a second. It will be inefficient.
It looks like you are looking for SEQUENCE, simple usage: 

CREATE SEQUENCE ip_seq
 START WITH     1
 INCREMENT BY   1
 NOCACHE
 NOCYCLE;


and then in select:

where id = ip_seq.nextval % ip_table_size