Add a mutex to attribute_assignment()

Guard attribute_assignment() against multiple threads accessing
this function simultaneously. Avoids errors like
NoMethodError: undefined method `customer_id=' for #<Username ..>