db(db.customer.last_name == "Smith").update(
number_of_times_contacted=db.customer.number_of_times_contacted + 1)
No different if updating a single record by ID.
Regarding your follow-up question, the exact function(s) will depend on the particular database system, but something like this:
from gluon.dal import Expression
db(db.customer.last_name == "Smith").update(
last_name=Expression(db, 'LTRIM(RTRIM(last_name))'))