DROP TABLE IF EXISTS tmp_table;
CREATE TEMPORARY TABLE tmp_table (id INT);
INSERT tmp_table
SELECT id
FROM table_a t1
WHERE EXISTS (
SELECT *
FROM table_a t2
WHERE t2.some_id = t1.some_id
AND t2.another_id = t1.another_id
AND t2.id < t1.id
)
;
DELETE FROM table_a WHERE id IN (SELECT id FROM tmp_table);