It's simply similiar to creating new one:
// Prepares a path to a local file
string filePath = @"C:\Files\images\Image.png";
// Prepares a CMS.IO.FileInfo object representing the local file
CMS.IO.FileInfo file = CMS.IO.FileInfo.New(filePath);
if (file != null)
{
// Creates a new media library file object
MediaFileInfo mediaFile = MediaFileInfoProvider.GetMediaFileInfo(library.LibraryID, "NewFolder/Image.png");
// Sets the media library file properties
mediaFile.FileName = "Image";
mediaFile.FileTitle = "File title";
mediaFile.FileDescription = "This file was added through the API.";
mediaFile.FilePath = "NewFolder/Image"; // Sets the path within the media library's folder structure
mediaFile.FileExtension = file.Extension;
mediaFile.FileMimeType = MimeTypeHelper.GetMimetype(file.Extension);
mediaFile.FileSiteID = SiteContext.CurrentSiteID;
mediaFile.FileLibraryID = library.LibraryID;
mediaFile.FileSize = file.Length;
// Saves the media library file
MediaFileInfoProvider.SetMediaFileInfo(mediaFile);
}
You got more examples in the documentation https://docs.kentico.com/display/API9/Media+libraries#Medialibraries-Updatingamedialibraryfile