doorkeeper-gem/doorkeeper — pull request #499 by mtparet (2014-10-25 21:13:40+00:00)
Title: Review order of conditions to optimize performance

If we do not need authorization, there is no need to perform a lookup (with an order_by) which could have a cost not negligible.