UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TESUpA6PFgtyW1/bEMoGGg5CuBsVXGg4Hwuloh9Odug=' 
WHERE 
  key_id = 'c5c799126503731a3dd92a673eb1ccd0c6335fde65b357c272e5ea9787994438' 
  AND (
    token = 'TESUpA6PFgtyW1/bEMoGGg5CuBsVXGg4Hwuloh9Odug=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032