UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9gpPOTA4INOSQKCL4o5YJtpFc1e/BInft3TJ17ParcM=' 
WHERE 
  key_id = 'a37fdf72e0c81d925f7bd108be24fcfa40d432407cae8ed6f1f24e783a7bbde8' 
  AND (
    token = '9gpPOTA4INOSQKCL4o5YJtpFc1e/BInft3TJ17ParcM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055