Lock wait timeout exceeded

Im using Resque with 3 workers in similar task. I think, some of the workers have problems when they try to access the same table or row. Not sure which. Is there anyway to avoid lock problems ? Any tunning for mysql db ?

Exception caught: #<ActiveRecord::StatementInvalid: Mysql2::Error: Lock wait timeout exceeded; try restarting transaction