UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TgJmb5k0K7hCGppTg+j0qjsocmecnWi33Epc+vpkjLU=' 
WHERE 
  key_id = '5fe62fef2573f27821082a1e7a81c7e6d3d75132ac9add0c7427e252aa1f64d6' 
  AND (
    token = 'TgJmb5k0K7hCGppTg+j0qjsocmecnWi33Epc+vpkjLU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023