Avoid pathologically slow query on mysql 5.1

With the old SQL, mysql 5.1 uses the index for create_time, which basically
causes a full table scan. (The query optimizer in mysql 5.5. does better
though).

With the new sql, the index for ticket_id is used instead, which is much
faster.