Deleting large amounts (4 million rows) of mysql data efficiently, on a very regular basis
The solution to your problem is a MySQL capability called "partitioning".  The documentation is here.

What partitioning does is store a single table in separate "partitions".  These are defined by a particular expression, usually a column value or range.  In your case, this would probably be based on endTime -- assuming that it is known when a record is created and it doesn't change.

You would store a day's worth of endTime in each partition.  Then the deletion step would be truncating a partition rather than deleting a bunch of rows in a big table.  The partition truncation would be a much faster method.