Equality in definition of midconvex function Let $f:I \rightarrow  \mathbb{R}$, where $I\subset \mathbb{R}$ is an interval, be midconvex, that is
$$f\left(\frac{x+y}{2}\right) \leq \frac{f(x)+f(y)}{2}$$ for all $x,y \in I$.
Assume that for some $x_0, y_0 \in \mathbb{R}$ such that $x_0 < y_0$  holds equality
$$f\left(\frac{x_0+y_0}{2}\right)= \frac{f(x_0)+f(y_0)}{2}.$$
What can we say about $f$ restricted to $[x_0, y_0]$ ? Maybe  $f|_{[x_0,y_0]}$ is
a sum of some additive function and some constant?
Thanks.
Added.
Maybe then $f(qx_0+(1-q)y_0)=qf(x_0)+(1-q)f(y_0)$ for $q=\frac{k}{2^n}$, where $n \in \mathbb{N}$, $k=0,1,...,2^n$ ?
 A: Consider the following example.  Let $B$ be a Hamel basis of $\mathbb R$ over the rationals $\mathbb Q$.  Thus each $x \in \mathbb R$ can be written uniquely as
$x = \sum_{b \in B} c_b(x) b$, where all but finitely many of the $c_b(x)$ are $0$ for any particular $x$.  Let $f(x) = c_{b_0}(x)^2$ for some given $b_0 \in B$.
Since $c_b\left(\frac{x+y}{2}\right) = \frac{c_b(x) + c_b(y)}{2}$, $f$ is midpoint-convex.  For any $x_0$ and $y_0$ such that $c_b(x_0) = c_b(y_0) = 0$ we have
$f\left(\frac{x_0+y_0}{2}\right) = \frac{f(x_0)+f(y_0)}{2} = 0$. But there is a dense set of points $ y_1$ where $f\left(\frac{x_0+y_1}{2}\right) < \frac{f(x_0)+f(y_1)}{2} $
A: If I understand your new question correctly (after the addition in
your question and some clarification in the comments) you want to
know, whether the following is true:

Let $f$ be a midpoint convex (a.k.a. Jensen convex) function on
  $[x_0,y_0]$, i.e. for any $x,y\in[x_0,y_0]$
  $$ f\left(\frac{x+y}2\right)\le \frac{f(x)+f(y)}2 \qquad (1)$$
  holds. Suppose that, moreover,
  $$ f\left(\frac{x_0+y_0}2\right)=\frac{f(x_0)+f(y_0)}2 \qquad (2).$$
  Then $f(qx_0+(1-q)y_0)=qf(x_0)+(1-q)f(y_0)$ for $q=\frac{k}{2^n}$,
  where $n \in \mathbb{N}$, $k=0,1,...,2^n$.


This can be shown by induction on $n$.
For $n=1$ the claim is equivalent to (1).
For $n=2$ we want to show that
$f\left(\frac{x_0+3y_0}4\right)=\frac{f(x_0)+3f(y_0)}4$ and
$f\left(\frac{3x_0+y_0}4\right)=\frac{3f(x_0)+f(y_0)}4$. Using (1)
for the points $\frac{x_0+3y_0}4$ and $\frac{3x_0+y_0}4$ we get
$$2f\left(\frac{x_0+y_0}2\right) \le f\left(\frac{x_0+3y_0}4\right) + f\left(\frac{3x_0+y_0}4\right). \qquad (3)$$
We also get from (1) that
$$2f\left(\frac{x_0+3y_0}4\right) \le f\left(\frac{x_0+y_0}2\right) +
f(y_0) \qquad (4)$$ and
$$2f\left(\frac{3x_0+y_0}4\right) \le f(x_0)+f\left(\frac{x_0+y_0}2\right)
\qquad (5)
$$
Combining (3), (4), (5) we get that
$$4f\left(\frac{x_0+y_0}2\right) \le 2f\left(\frac{x_0+3y_0}4\right) + 2f\left(\frac{3x_0+y_0}4\right) \le f(x_0)+2f\left(\frac{x_0+y_0}2\right)+f(y_0).$$
But since from (2) we know that in fact the equality holds for the
leftmost and rightmost expression, we get that equality holds in
(4) and (5), too. This implies our claim for $n=2$.
Suppose that the claim is true for $n$, we will show it for
$n+1$: Let $q=\frac{k}{2^{n+1}}$. If $k$ is even, the claim
follows from induction hypothesis. If $k$ is odd, we can use what
we proved in the case $n=2$, using either $\frac{k-1}{2^{n+1}}$
and $\frac{k+3}{2^{n+1}}$ or $\frac{k-3}{2^{n+1}}$ and
$\frac{k+1}{2^{n+1}}$ instead of $x_0$ and $y_0$. (We can choose
whichever pair belongs to the original interval. For these point
the claim is true, since $k\pm1$, $k\pm 3$ are even.)

The proof is basically a modification of the proof that every
midpoint convex function is rationally convex, see this question:
Midpoint-Convex and Continuous Implies Convex
(You can try whether other proofs mentioned there can be modified to
you situation too.)
