inveniogc: guest users gc optimization

* Improves algorithm used to garbage collect user queries generated
  by guests users.
  (closes #428)

Reported-by: Ferran Jorba <Ferran.Jorba@uab.cat>
Signed-off-by: Samuele Kaplun <samuele.kaplun@cern.ch>