It may be tripping up on the forward slashes, see if this works:
lyr = arcpy.mp.LayerFile(r'C:\gis\layer.lyrx')
for layer in lyr.listLayers():
layer.updateConnectionProperties(r'C:\old.gdb', r'C:\data\newGDB.gdb')
lyr.saveACopy(r'C:\gis\newLayer.lyrx')
(I suspect lyr.updateConnectionProperties(r'C:\old.gdb', r'C:\data\newGDB.gdb')
would do the trick, too).
A layer file can, theoretically, contain multiple layers at its top level so think of it as a container that has-many layers, not a layer itself.