How to change value when passing marker with certain comment
You need to check how expressions work. An expression sets the value of a property with the first line that returns a value. So for example an expression could just be:
40

since that line returns the value 40. The second line in your expression value = 40 does not return a value, it attempts to set the value property to 40, which doesn't work, because value is read-only.
What you need to do is return 40 if the time is after the marker, and if not return the current value, thus:
if (marker.comment(&quot;R1 L1&quot;).time &gt; time){
  40;
} else {
  value;
}

Or more tersely, using ternary notation, which uses the form (condition)? &lt;value if true&gt; : &lt;value if false&gt;, thus:
(marker.comment(&quot;R1 L1&quot;).time &gt; time)? 40 : value