UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tCS8OCubI987qkBVR9bOsLBpsUJEdgZ6v+HnoR90klc=' 
WHERE 
  key_id = '124f32b07ca1a6de812faf6a0ba703ce4cb274bab5e56060428a2f0f59af94ab' 
  AND (
    token = 'tCS8OCubI987qkBVR9bOsLBpsUJEdgZ6v+HnoR90klc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025