fixes #1831 adding expiration check to working query