Maybe a combination of the functions SECOND() and MOD() will help. Using your test data as follows (dbfiddle here, also tested with MySQL 5.7):
create table t_ (
id_ int primary key
, date_ datetime
);
insert into t_ values
(1,'2017-07-10 10:11:10'),(2,'2017-07-10 10:11:15'),
(3,'2017-07-10 10:11:20'),(4,'2017-07-10 10:11:25'),
(5,'2017-07-10 10:11:30'),(6,'2017-07-10 10:11:35'),
(7,'2017-07-10 10:11:40');
We can get the "second" value of the date_, for every 15th second, like so:
select second(date_)
from t_
where mod( second( date_ ), 15) = 0 ;
-- output
+---------------+
| second(date_) |
+---------------+
| 15 |
| 30 |
+---------------+
The SECOND() value of the "last registered date" would be ...
select second( max( date_) ) from t_ ;
-- output
+-----------------------+
| second( max( date_) ) |
+-----------------------+
| 40 |
+-----------------------+
Take the "last registered date" into account:
select *
from t_
where mod (
( select 60 - second( max(date_) ) from t_ )
+ second( date_ )
, 15
) = 0 ;
-- (your required) output
+-----+---------------------+
| id_ | date_ |
+-----+---------------------+
| 1 | 2017-07-10 10:11:10 |
| 4 | 2017-07-10 10:11:25 |
| 7 | 2017-07-10 10:11:40 |
+-----+---------------------+
This query should also work if there are "gaps" in the date_ (the MOD() function does not care) eg if we DELETE everything from the table t_ and insert the following rows:
-- IDs 5 (10:11:20) and 11 (10:11:50) missing
insert into t_ values
(1,'2017-07-10 10:11:00'), (2,'2017-07-10 10:11:05'),
(3,'2017-07-10 10:11:10'), (4,'2017-07-10 10:11:15'),
(6,'2017-07-10 10:11:25'),
(7,'2017-07-10 10:11:30'), (8,'2017-07-10 10:11:35'),
(9,'2017-07-10 10:11:40'), (10,'2017-07-10 10:11:45'),
(12,'2017-07-10 10:11:55'),
(13,'2017-07-10 10:12:00'),(14,'2017-07-10 10:12:05');
Our query will return:
mysql> select *
-> from t_
-> where mod (
-> ( select 60 - second( max(date_) ) from t_ )
-> + second( date_ )
-> , 15
-> ) = 0 ;
+-----+---------------------+
| id_ | date_ |
+-----+---------------------+
| 2 | 2017-07-10 10:11:05 |
| 8 | 2017-07-10 10:11:35 |
| 14 | 2017-07-10 10:12:05 |
+-----+---------------------+
If there are (date/time) duplicates, then ... you will see them in the output. You can add a BETWEEN clause (as @Jess suggested) at the end of the query, if you need a "master interval".
UPDATE
It seems that you also want to capture values that are smaller/greater than the (exact multiples of) 15 seconds - you have mentioned 18,32, and 57 (seconds), respectively. With a slightly modified query, you can pick up these values, too. Eg the following query has a "tolerance" of +/- 3 seconds eg if the "exact" second is 15, we'd also get 12,13,14,16,17,18. Notice that this "frame" moves according to the MAX() value ie your "last registered" time.
select *
from t_
where mod (
( select 60 - second( max(date_) ) from t_ )
+ second( date_ )
, 15
) in (0,1,2,3,12,13,14) ;
2 sets of test data (dbfiddle):
"last registered" near the full minute ,
"last registered" at the 30 second mark