Locking task rows using FOR UPDATE