WHERE parent_category_id IS NOT NULL
OR (id NOT IN (SELECT id FROM category WHERE parent_category_id IS NOT NULL) AND parent_category_id IS NULL)
Here are a couple of ways you can try from a performance standpoint or just in case you prefer different code structures
Using EXISTS instead of IN (http://dev.mysql.com/doc/refman/5.7/en/exists-and-not-exists-subqueries.html)
SELECT * FROM category c WHERE parent_category_id IS NOT NULL OR ( parent_category_id IS NULL AND NOT EXISTS (SELECT * FROM category pc WHERE pc.parent_category_id = c.id) )
Or using Joins
SELECT DISTINCT c.* FROM category c LEFT JOIN category pc ON c.id = pc.parent_category_id WHERE c.parent_category_id IS NOT NULL OR (c.parent_category_id IS NULL AND pc.parent_category_id IS NULL)
Exists and Joins are usually thought to be more efficient on performance but this could be a case where it wouldn't be just test and see what you like.