UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M1L+LJwDgGkfAJOYiOm/wVoY2lwVihinVHApcFlcoBo=' 
WHERE 
  key_id = '47132f2e770bfbdb9f4fceee689069a757d43157331d66b215a9b93b166bac73' 
  AND (
    token = 'M1L+LJwDgGkfAJOYiOm/wVoY2lwVihinVHApcFlcoBo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027