UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bsxy7j5Gh+hVgPSXQVLcp6LNxNu11OutiUherb/2abk=' 
WHERE 
  key_id = '97d4fdf31ee35bfc57a28c2bea547ba76e823ebf7e44319ed0c6c651ad47e8a2' 
  AND (
    token = 'Bsxy7j5Gh+hVgPSXQVLcp6LNxNu11OutiUherb/2abk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035