Use xpath in such a way that it contains text of that element. Here's how to do it -
String idVal = driver.findElement(By.xpath("//div[contains(text(),'4590 6565 6565 6565')]")).getAttribute("id");System.out.println(idVal);
Hope this helps.