UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KRLaOWRq/DnDHpxAI9GSMnDhdpsInxP1uND0JJszAb0=' 
WHERE 
  key_id = '123fe258b658958924169c187074d6ed053903acf981729b2e329d0cb2e45570' 
  AND (
    token = 'KRLaOWRq/DnDHpxAI9GSMnDhdpsInxP1uND0JJszAb0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032