It is very simple for your XML file. Convert the XML to a simple hierarchial object. Set the values and save it back as XML.
$sxe = new SimpleXMLElement('test.xml', NULL, TRUE);
$linha=$sxe->linha;
$linha[2]->coluna2=30;
file_put_contents('test.xml', $sxe->asXML());
Where
$linha[2]
refer to second linha