SELECT *
FROM table1 t1
LEFT JOIN
table2
ON o.id =
(
SELECT o_id
FROM table2 t2
WHERE t2.c_id = t1.c_id
ORDER BY
t2.c_id DESC, t2.isHeadOffice DESC, t2.o_id DESC
LIMIT 1
)
Cree un índice en table2 (c_id, isHeadOffice, o_id) para que esto funcione rápido.
El ORDER BY La cláusula en la subconsulta puede parecer redundante, pero es necesaria para MySQL para elegir el índice correcto.