Ok, thanks for your reply, it led me to the solution. It's very simple, I don't know why I couldn't resolve it earlier...
So, after querying Table2 I changed the while(dr.Read()) part to this:
while (dr.Read())
{
ListItem li = hibakodCheckBoxList.Items.FindByValue(dr[0].ToString());
if (li != null)
{
li.Selected = true;
}
}