UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KywQXoJnoZzIkBcns/brPTpsIFrPAZh+d2SBEoyxiy8=' 
WHERE 
  key_id = '304c38d96d6b4d29921e378f3ce6db2aa3e9a5fcfe37d97ff268325c3344648f' 
  AND (
    token = 'KywQXoJnoZzIkBcns/brPTpsIFrPAZh+d2SBEoyxiy8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028