By unread, do you mean when using a client it appears as unread?
I have observed that if a client has not logged in to check mail for an account, the mail will be in /home/user-data/mail/mailboxes/example.com/username/new/. However, if a client has logged in the mail will be moved out of /new/, even though it may be still indicate unread in the mail client.
I also observed that. But only works partly as you mentioned.
But if the user logs in, and does not click/open the email, the mail will still be moved out (even tho the unread count on the webpage does not change, as expected).
Well funny enough I got the solution with that help of maildir word.
With a command like this: ls /home/user-data/mail/mailboxes/*/*/cur/ | egrep '^.+,$'| wc -l
it’s possible to get the exact number of unread emails of every user. Or actually just one user.
The magic is on the name of the email file, explained on this StackOverflow post.