select forupdate table where ... table.field = "new value"; table.renamePrimaryKey(); table.update();