UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'afAsJCSSygxHUO+OQMuC38LkGQ/jgGmsXKeXCdcTyXc=' 
WHERE 
  key_id = '82d4853039e5dc51572aac3d0a9cfb79a09caaa7f32903215271e98f0f2dc168' 
  AND (
    token = 'afAsJCSSygxHUO+OQMuC38LkGQ/jgGmsXKeXCdcTyXc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039