Fix job locking

This should get us the best of both worlds. Postgres and MySQL will get the performance improvements from #29 while allowing DB servers with different behaviors #38 to fall back to the old read ahead method. This should also fix the lock issues people are seeing here #40.
Also on top of all that, this fixes a compatibility issue with ActiveRecord 3.0 and 3.1 which do not support with_lock.