UPDATE users AS a,
       friendships AS b
SET b.accept      = /*accept*/true,
    b.createdTime = /*createdTime*/0,
    b.removedTime = 0
WHERE a.userId     = b.activeId AND
      b.passiveId  = /*passiveId*/0 AND
      a.foreignKey = /*activeId*/''
