Adding an optimized valid/invalid shares query

* This should speed up the process of finding shares for round and users

Addresses #246
Merge pull request #254 from TheSerapher/issue-246-sql-optimized

Adding an optimized valid/invalid shares query