The as-is query will not work - you need to identify all columns that are not aggregated in GROUP BY.
Not clear, but if you want to count unique conversations, use:
SELECT COUNT(DISTINCT m.conversation_id) AS unread
FROM MESSAGES m
WHERE m.to_id = ?
AND m.readed = 0
AND m.hide_from != ?
... otherwise use:
SELECT COUNT(*) AS unread
FROM MESSAGES m
WHERE m.to_id = ?
AND m.readed = 0
AND m.hide_from != ?
- No subqueries needed
ORDER BY - , TOPGROUP BY , MESSAGES.id